<template>
	<div class="TaskRejectList">
		<template>
			<el-table :data="tableData" row-key="id" style="width: 100%">
				<el-table-column prop="index" label="序号" width="50"> </el-table-column>
				<el-table-column prop="task_name" label="任务名称" > </el-table-column>
				<el-table-column prop="sub_set_name" label="归属数据子集" > </el-table-column>
				<el-table-column prop="task_status_str" label="任务状态" > </el-table-column>
				<el-table-column prop="user_name" label="提交人" > </el-table-column>
				<el-table-column prop="update_time" label="驳回时间" > </el-table-column>
				<el-table-column prop="audit_remark" label="备注" > </el-table-column>
				<el-table-column label="操作"  align="center">
					<template slot-scope="scope">
						<el-button @click="submitTask(scope.row)">继续编辑</el-button>
					</template>
				</el-table-column>
			</el-table>
		</template>
		<div class="pagination">
			<el-pagination
				background
				layout="sizes ,prev, pager, next"
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:page-sizes="[5 , 10, 15, 20]"
				:page-size="pagination.page_size"
				:current-page="pagination.page_index"
				:total="pagination.total">
			</el-pagination>
		</div>
	</div>
</template>

<script>
	import bus from '../common/bus';
	import TaskMangeService from '../../services/TaskMangeService.js';
	export default {
		data() {
			return {
		      TaskMangeService:new TaskMangeService(),
			  tableData: [],
			  pagination:{
				page_size:10,
				page_index:1,
				total:0,
			  }
			};
		},
		methods: {
			//分页
			handleSizeChange(val) {
			    this.pagination.page_size = val;
				this.InitialData();
			},
			handleCurrentChange(val) {
				this.pagination.page_index = val;
				this.InitialData();
			},
			
			//初始请求
			async InitialData(){
				let parmes = {
					"page_size":  this.pagination.page_size,
					"page_index": this.pagination.page_index,
					"task_status_list": [101050]
				}
				let res = await this.TaskMangeService.getTask(parmes);
				if(res.code == 200){
					this.tableData = res.data.list.length>0?res.data.list:[];
					this.pagination.total=res.data.pagination.total;
					var index =(this.pagination.page_index - 1) * this.pagination.page_size;
					this.tableData.map((ele, i) => {
							this.$set(ele, "index", index + i + 1);   
					});
				}
			},
			
			//跳转
			submitTask(obj){
				this.$router.push({path:'/TaskReject',query:{task_id:obj.task_id}})
			}
		},
		mounted(){
			this.InitialData();
		}
	}
</script>

<style lang="scss" scoped>
	.TaskRejectList{
		background: #fff;
		padding: 15px;
		box-sizing: border-box;
	}
</style>